package com.dragon.sdgp.common;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;

/**
 * @AUTHOR : Dragon_Yang
 * @File : R
 * @DESCRIPTION :
 * @DATE : 2023/3/12 15:13
 */
@Data
@AllArgsConstructor
public class R implements Serializable {

    private int code;
    private String msg;
    private Object data;

    public R(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static R success(int code, String msg, Object data){
        return new R(code, msg, data);
    }

    public static R success(int code, Object data){
        return success(code, "success", data);
    }

    public static R fail(int code, String msg){
        return new R(code, msg);
    }

}
